package com.hwtx.form.domain.handle;

import com.hwtx.form.domain.def.FormDef;
import com.hwtx.form.domain.vo.FormData;
import com.hwtx.form.domain.vo.FormListVo;
import com.hwtx.form.domain.vo.FormRepData;
import com.hwtx.form.dto.FormListQuery;
import com.hwtx.form.query.FormValueQuery;
import io.geekidea.boot.framework.page.Paging;

public interface FormDataHandle {

    default void init() {
    }

    default void destroy() {
    }

    default FormRepData getFormData(FormDef formDef, FormValueQuery formValueQuery) {
        return null;
    }

    default Object saveFormData(FormDef formDef, FormData formData) throws Exception {
        return true;
    }

    default Object removeFormData(FormDef formDef, FormValueQuery formValueQuery) {
        return true;
    }

    default FormListVo<?> query(FormDef formDef, FormListQuery formListQuery) {
        return new FormListVo<>();
    }

    default Paging<?> page(FormDef formDef, FormListQuery formListQuery) {
        return new Paging<>();
    }
}
